package com.huifer.wgx.model;

import com.fasterxml.jackson.annotation.JsonIgnore;
import java.math.BigDecimal;
import java.util.Collection;
import java.util.Objects;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * <p>Title : FieldPointEntity </p>
 * <p>Description : </p>
 *
 * @author huifer
 * @date 2019-03-20
 */
@Entity
@Table(name = "t_field_point", schema = "at15", catalog = "")
public class FieldPointEntity {

    private Long fieldPointId;
    private String fieldPointName;
    private String fieldPointManholeCoverType;
    private String fieldPointIsmesh;
    private BigDecimal fieldPointDeep;
    private String fieldPointSize;
    private Long workId;
    private Long personnelId;
    private Long rtkId;
    private Long filedId;
    private Collection<FieldLineEntity> tFieldLinesByFieldPointId;
    private Collection<FieldLineEntity> tFieldLinesByFieldPointId_0;
    private WorkEntity tWorkByWorkId;
    private PersonnelEntity tPersonnelByPersonnelId;
    private RtkPointEntity tRtkPointByRtkId;
    private FileEntity tFileByFiledId;

    @Id
    @Column(name = "field_point_id")
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    public Long getFieldPointId() {
        return fieldPointId;
    }

    public void setFieldPointId(Long fieldPointId) {
        this.fieldPointId = fieldPointId;
    }

    @Basic
    @Column(name = "field_point_name")
    public String getFieldPointName() {
        return fieldPointName;
    }

    public void setFieldPointName(String fieldPointName) {
        this.fieldPointName = fieldPointName;
    }

    @Basic
    @Column(name = "field_point_manhole_cover_type")
    public String getFieldPointManholeCoverType() {
        return fieldPointManholeCoverType;
    }

    public void setFieldPointManholeCoverType(String fieldPointManholeCoverType) {
        this.fieldPointManholeCoverType = fieldPointManholeCoverType;
    }

    @Basic
    @Column(name = "field_point_ismesh")
    public String getFieldPointIsmesh() {
        return fieldPointIsmesh;
    }

    public void setFieldPointIsmesh(String fieldPointIsmesh) {
        this.fieldPointIsmesh = fieldPointIsmesh;
    }

    @Basic
    @Column(name = "field_point_deep")
    public BigDecimal getFieldPointDeep() {
        return fieldPointDeep;
    }

    public void setFieldPointDeep(BigDecimal fieldPointDeep) {
        this.fieldPointDeep = fieldPointDeep;
    }

    @Basic
    @Column(name = "field_point_size")
    public String getFieldPointSize() {
        return fieldPointSize;
    }

    public void setFieldPointSize(String fieldPointSize) {
        this.fieldPointSize = fieldPointSize;
    }

    @Basic
    @Column(name = "work_id")
    public Long getWorkId() {
        return workId;
    }

    public void setWorkId(Long workId) {
        this.workId = workId;
    }

    @Basic
    @Column(name = "personnel_id")
    public Long getPersonnelId() {
        return personnelId;
    }

    public void setPersonnelId(Long personnelId) {
        this.personnelId = personnelId;
    }

    @Basic
    @Column(name = "rtk_id")
    public Long getRtkId() {
        return rtkId;
    }

    public void setRtkId(Long rtkId) {
        this.rtkId = rtkId;
    }

    @Basic
    @Column(name = "filed_id")
    public Long getFiledId() {
        return filedId;
    }

    public void setFiledId(Long filedId) {
        this.filedId = filedId;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        FieldPointEntity that = (FieldPointEntity) o;
        return Objects.equals(fieldPointId, that.fieldPointId) &&
                Objects.equals(fieldPointName, that.fieldPointName) &&
                Objects.equals(fieldPointManholeCoverType, that.fieldPointManholeCoverType) &&
                Objects.equals(fieldPointIsmesh, that.fieldPointIsmesh) &&
                Objects.equals(fieldPointDeep, that.fieldPointDeep) &&
                Objects.equals(fieldPointSize, that.fieldPointSize) &&
                Objects.equals(workId, that.workId) &&
                Objects.equals(personnelId, that.personnelId) &&
                Objects.equals(rtkId, that.rtkId) &&
                Objects.equals(filedId, that.filedId);
    }

    @Override
    public int hashCode() {
        return Objects
                .hash(fieldPointId, fieldPointName, fieldPointManholeCoverType, fieldPointIsmesh,
                        fieldPointDeep, fieldPointSize, workId, personnelId, rtkId, filedId);
    }

    @OneToMany(mappedBy = "tFieldPointByFieldLineStartPointId")
    @JsonIgnore
    public Collection<FieldLineEntity> gettFieldLinesByFieldPointId() {
        return tFieldLinesByFieldPointId;
    }

    public void settFieldLinesByFieldPointId(
            Collection<FieldLineEntity> tFieldLinesByFieldPointId) {
        this.tFieldLinesByFieldPointId = tFieldLinesByFieldPointId;
    }

    @OneToMany(mappedBy = "tFieldPointByFieldLineEndPointId")
    @JsonIgnore
    public Collection<FieldLineEntity> gettFieldLinesByFieldPointId_0() {
        return tFieldLinesByFieldPointId_0;
    }

    public void settFieldLinesByFieldPointId_0(
            Collection<FieldLineEntity> tFieldLinesByFieldPointId_0) {
        this.tFieldLinesByFieldPointId_0 = tFieldLinesByFieldPointId_0;
    }

    @ManyToOne
    @JoinColumn(name = "work_id", referencedColumnName = "work_id",insertable = false,updatable = false)
    public WorkEntity gettWorkByWorkId() {
        return tWorkByWorkId;
    }

    public void settWorkByWorkId(WorkEntity tWorkByWorkId) {
        this.tWorkByWorkId = tWorkByWorkId;
    }

    @ManyToOne
    @JoinColumn(name = "personnel_id", referencedColumnName = "personnel_id",insertable = false,updatable = false)
    public PersonnelEntity gettPersonnelByPersonnelId() {
        return tPersonnelByPersonnelId;
    }

    public void settPersonnelByPersonnelId(PersonnelEntity tPersonnelByPersonnelId) {
        this.tPersonnelByPersonnelId = tPersonnelByPersonnelId;
    }

    @ManyToOne
    @JoinColumn(name = "rtk_id", referencedColumnName = "rtk_id",insertable = false,updatable = false)
    public RtkPointEntity gettRtkPointByRtkId() {
        return tRtkPointByRtkId;
    }

    public void settRtkPointByRtkId(RtkPointEntity tRtkPointByRtkId) {
        this.tRtkPointByRtkId = tRtkPointByRtkId;
    }

    @ManyToOne
    @JoinColumn(name = "filed_id", referencedColumnName = "file_id",insertable = false,updatable = false)
    public FileEntity gettFileByFiledId() {
        return tFileByFiledId;
    }

    public void settFileByFiledId(FileEntity tFileByFiledId) {
        this.tFileByFiledId = tFileByFiledId;
    }
}
